#ifndef GKO_POOL_INCLUDE_GP_PATH_H
#define GKO_POOL_INCLUDE_GP_PATH_H

static const int GKO_FILE = 0001; // file and for file test. for example: flag & GKO_FILE
static const int GKO_DIR = 0002; // dir and dir test
static const int GKO_NONE = 0004; // nonexisted and for nonexisted test
static const int GKO_OTHER = 0000; // TODO: rename
static const int GKO_LFILE = 0011; // symlink to file
static const int GKO_LDIR = 0012; // symlink to dir
static const int GKO_LNONE = 0014; // symlink to nonexist
static const int GKO_LOTHER = 0010; // symlink to other , TODO: rename
static const int GKO_LINK = 0010; // for symlink test
static const int GKO_ERR = 0100; // error

/// @desc: ../path//// -> ../path
int inplace_strip_tailing_slash(char* path);
/// @desc: ../path -> ../path/
int inplace_add_tailing_slash(char* path);
/// @desc: get the base name of a string
int get_base_name_index(char* in, const char* out);
/// @desc: merge into dir_name/base_name
int merge_path(char* out, const char* dir_name, const char* base_name);
/// @desc: change remote path to local path, store it in path
int change_to_local_path(char* path, const char* req_path,
                         const char* local_path, char dst_path_exist);
/// @desc: get the symlink dest's absolute path, store it in abs_path
char* symlink_dest_to_abs_path(char* abs_path, const char* symlink);
/// @desc: generate snap file path with requested local path and requested remote uri
unsigned gen_snap_fpath(char* snap_fpath, const char* local_path,
                        const char* uri);
/// @desc: generate snap file path with requested localpath and requested remote uri
int path_type(const char* path);
/// @desc: generate snap file path with requested localpath and requested remote uri
int mk_dir_symlink_file(s_job_t* jb, char* to_continue);
/// @desc: correct the file and dir mode, cause for write in we create them with mode | S_IWUSR
int correct_mode(s_job_t* jb);
/// @desc: covert the remote path recv from JOIN to local path
int process_path(s_job_t* jb);

#endif // header file protect
// END: CODEREVIEW